import 'package:rfid/generated/json/base/json_convert_content.dart';
import 'package:rfid/entity/inventory_entity.dart';

InventoryEntity $InventoryEntityFromJson(Map<String, dynamic> json) {
	final InventoryEntity inventoryEntity = InventoryEntity();
	final int? count = jsonConvert.convert<int>(json['count']);
	if (count != null) {
		inventoryEntity.count = count;
	}
	final List<InventoryList>? list = jsonConvert.convertListNotNull<InventoryList>(json['list']);
	if (list != null) {
		inventoryEntity.list = list;
	}
	return inventoryEntity;
}

Map<String, dynamic> $InventoryEntityToJson(InventoryEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['count'] = entity.count;
	data['list'] =  entity.list?.map((v) => v.toJson()).toList();
	return data;
}

InventoryList $InventoryListFromJson(Map<String, dynamic> json) {
	final InventoryList inventoryList = InventoryList();
	final String? reader = jsonConvert.convert<String>(json['reader']);
	if (reader != null) {
		inventoryList.reader = reader;
	}
	final String? epc = jsonConvert.convert<String>(json['epc']);
	if (epc != null) {
		inventoryList.epc = epc;
	}
	final String? blockData = jsonConvert.convert<String>(json['block_data']);
	if (blockData != null) {
		inventoryList.blockData = blockData;
	}
	final dynamic? pc = jsonConvert.convert<dynamic>(json['pc']);
	if (pc != null) {
		inventoryList.pc = pc;
	}
	final dynamic? tid = jsonConvert.convert<dynamic>(json['tid']);
	if (tid != null) {
		inventoryList.tid = tid;
	}
	final int? scanCount = jsonConvert.convert<int>(json['scan_count']);
	if (scanCount != null) {
		inventoryList.scanCount = scanCount;
	}
	final List<InventoryListAnts>? ants = jsonConvert.convertListNotNull<InventoryListAnts>(json['ants']);
	if (ants != null) {
		inventoryList.ants = ants;
	}
	return inventoryList;
}

Map<String, dynamic> $InventoryListToJson(InventoryList entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['reader'] = entity.reader;
	data['epc'] = entity.epc;
	data['block_data'] = entity.blockData;
	data['pc'] = entity.pc;
	data['tid'] = entity.tid;
	data['scan_count'] = entity.scanCount;
	data['ants'] =  entity.ants?.map((v) => v.toJson()).toList();
	return data;
}

InventoryListAnts $InventoryListAntsFromJson(Map<String, dynamic> json) {
	final InventoryListAnts inventoryListAnts = InventoryListAnts();
	final int? no = jsonConvert.convert<int>(json['no']);
	if (no != null) {
		inventoryListAnts.no = no;
	}
	final int? rssi = jsonConvert.convert<int>(json['rssi']);
	if (rssi != null) {
		inventoryListAnts.rssi = rssi;
	}
	final int? count = jsonConvert.convert<int>(json['count']);
	if (count != null) {
		inventoryListAnts.count = count;
	}
	return inventoryListAnts;
}

Map<String, dynamic> $InventoryListAntsToJson(InventoryListAnts entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['no'] = entity.no;
	data['rssi'] = entity.rssi;
	data['count'] = entity.count;
	return data;
}